#pragma once
#include "peparse.h"

class CKnrlMemImage :
    public CPEParse
{
public:
    CKnrlMemImage(void);
    CKnrlMemImage(IN HANDLE hDriver, IN ULONG ImgBase = 0, IN ULONG Size = 0);
    virtual ~CKnrlMemImage(void);

public:
    VOID
    SetDriverHandle(
        IN HANDLE hDriver
    );

    VOID
    SetImageBase(
        IN ULONG ImgBase,
        IN ULONG Size = 0
    );

    ULONG
    GetImageBase(
        VOID
    );

public:

    virtual BOOL PeRead(IN ULONGLONG Offset, OUT PVOID Buffer, IN ULONG Length);
    virtual BOOL PeOpen();
    virtual BOOL PeWrite(IN ULONGLONG Offset, IN PVOID Buffer, IN ULONG Length);
    virtual VOID PeClose();

private:
    HANDLE m_hDriver;
    ULONG m_ImgBase;
    ULONG m_ImgSize;
};

